import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useAppStore = defineStore('app', () => {
    // 默认语言设置
    const locale = ref(localStorage.getItem('app-locale') || 'zh-CN')

    // 切换语言
    function setLocale(lang) {
        locale.value = lang
        localStorage.setItem('app-locale', lang)
    }

    return {
        locale,
        setLocale,
    }
})
